package com.zoffy.catdiarybackend.service;

import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zoffy.catdiarybackend.common.IdRequest;
import com.zoffy.catdiarybackend.common.PageRequest;
import com.zoffy.catdiarybackend.model.dto.article.*;
import com.zoffy.catdiarybackend.model.entity.Article;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zoffy.catdiarybackend.model.vo.ArticleTinyVo;
import com.zoffy.catdiarybackend.model.vo.ArticleVo;
import com.zoffy.catdiarybackend.model.vo.Permissions;
import jakarta.servlet.http.HttpServletRequest;

/**
* @author 86170
* @description 针对表【article】的数据库操作Service
* @createDate 2024-06-09 12:15:17
*/
public interface ArticleService extends IService<Article> {
    /**
     *
     * @param request HttpServletRequest
     * @param articleCreateRequest 文章创建请求
     * @return 创建的文章id
     */
    long createArticle(HttpServletRequest request, ArticleCreateRequest articleCreateRequest);


    IPage<ArticleTinyVo> listArticleTinyVoByPage(PageRequest pageRequest);
    IPage<ArticleTinyVo> listOwnArticleTinyVoByPage(HttpServletRequest request,PageRequest pageRequest);
    ArticleVo getArticleVoById(HttpServletRequest request,IdRequest idRequest);
    boolean updateArticleById(ArticleUpdateRequest articleUpdateRequest,HttpServletRequest request);
    boolean updatePermissionById(HttpServletRequest request,PermissionUpdateRequest permissionUpdateRequest);
    boolean deleteArticlesById(HttpServletRequest request,long[] ids);
    //供前端协作服务器进行权限校验向外暴露的方法
    boolean checkPermission(CheckPermissionRequest checkPermissionRequest);
    //处理前端协作服务器的回调进行数据持久化
    void updateCollaborationArticle(ArticleCollaborativeUpdateRequest articleCollaborativeUpdateRequest);
    Permissions getPermissionsById(HttpServletRequest request,IdRequest idRequest);
}
